﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace JuCheap.Core.Data.Migrations
{
    public partial class update_model : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_TimePeriods_BanCis_BanCiId",
                table: "TimePeriods");

            migrationBuilder.DropIndex(
                name: "IX_TimePeriods_BanCiId",
                table: "TimePeriods");

            migrationBuilder.DropColumn(
                name: "BanCiId",
                table: "TimePeriods");

            migrationBuilder.RenameColumn(
                name: "PositionType",
                table: "JobPositionTypes",
                newName: "Name");

            migrationBuilder.AddColumn<string>(
                name: "TimePeriods",
                table: "BanCis",
                nullable: true);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "TimePeriods",
                table: "BanCis");

            migrationBuilder.RenameColumn(
                name: "Name",
                table: "JobPositionTypes",
                newName: "PositionType");

            migrationBuilder.AddColumn<int>(
                name: "BanCiId",
                table: "TimePeriods",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_TimePeriods_BanCiId",
                table: "TimePeriods",
                column: "BanCiId");

            migrationBuilder.AddForeignKey(
                name: "FK_TimePeriods_BanCis_BanCiId",
                table: "TimePeriods",
                column: "BanCiId",
                principalTable: "BanCis",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }
    }
}
